<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>记账网页</title>
        <script>
            function Count(){
                L=document.my.elements;
                for (var i=0;i<L.length;i++){
                    {
                        if(L[i].checked){
                            S=L[i].value
                        }
                    }
                }
                H=document.my.elements[4].value;
                J=document.my.elements[5].value;
                document.getElementById("Con").innerHTML+='【'+S+'】'+"事由："+H+"；"+"价格："+J+"。<br>";
                document.getElementById("Ou").innerHTML=Number(document.getElementById("Ou").innerHTML)+Number(J);
            }
        </script>
        
    </head>
    <body>
            <div  style="color: red;">
            <form method="" action="" name="my">
            <input type="radio" name="TP" id="C" value="衣" />衣
            <input type="radio" name="TP" id="F" value="食" />食
            <input type="radio" name="TP" id="W" value="行" />行
            <input type="radio" name="TP" id="O" value="其他" />其他
            <br>事由：
            <input type="text" name="cause" id="Ca" value="" />
            ；价格：
            <input type="text" name="price" id="PR" value="" />
            <input type="button" name="add" value="add" onclick="Count()"/>
        </form>
        <div id="Con"></div>
        <div>合计：<span id="Ou"></span></div>
        </div>
        
        
        

    </body>
</html>